﻿using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;

namespace EcoSystem
{
    public interface IDataPermissionManager : IApplicationService
    {
        /// <summary>
        ///  批量获取数据权限
        /// </summary>
        /// <param name="providerName">适配类型（用户、角色、客户端）</param>
        /// <param name="providerKey">适配身份ID标识</param>
        /// <param name="enCode">数据权限业务类别代码</param>
        /// <returns></returns>
        Task<List<DataPermissionGrantDto>> GetPermissionsAsync(string providerName, string providerKey, string enCode);

        /// <summary>
        /// 批量保存数据权限
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Task<List<DataPermissionGrantDto>> SavePermissionsAsync(SaveDataPermissionGrantsInputDto input);

        /// <summary>
        /// 删除指定业务的全部数据权限
        /// </summary>
        /// <param name="providerName">适配类型（用户、角色、客户端）</param>
        /// <param name="providerKey">适配身份ID标识</param>
        /// <param name="enCode">数据权限业务类别代码</param>
        /// <returns></returns>
        Task DeleteAsync(string providerName, string providerKey, string enCode);

        /// <summary>
        /// 设置单个数据权限
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        Task SetAsync(SetDataPermissionInputDto input);

        /// <summary>
        /// 判断当前身份是否具体指定业务类型指定数据ID标识的数据权限
        /// </summary>
        /// <param name="enCode"></param>
        /// <param name="dataId"></param>
        /// <returns></returns>
        Task<bool> IsGrantedAsync(string enCode, string dataId);
    }
}

